home *** CD-ROM | disk | FTP | other *** search
- Path: solon.com!not-for-mail
- From: seebs@solutions.solon.com (Peter Seebach)
- Newsgroups: comp.lang.c
- Subject: Re: Looking for semaphore example.
- Date: 31 Mar 1996 01:25:08 -0600
- Organization: Usenet Fact Police (Undercover)
- Message-ID: <4jlc0k$j02@solutions.solon.com>
- References: <4jc5hd$1vlv@ilx018.iil.intel.com> <828220289snz@genesis.demon.co.uk>
- NNTP-Posting-Host: solutions.solon.com
-
- In article <828220289snz@genesis.demon.co.uk>,
- Lawrence Kirby <fred@genesis.demon.co.uk> wrote:
- >>Hi -
- >>I'm looking for a simple example of implementation of semaphore in C .
-
- >Not possible - the C language doesn't support semaphores. You'll have
- >to go beyond the C language to get this.
-
- Nonsense! You'll just need to go beyond the C language to implement
- semaphores in a useful or meaningful way. :) You could easily implement
- a semaphore algorithm in C, it just wouldn't matter in pure C, because
- you'd only ever have the one process.
-
- Unless you wanted to implement software-level coprocesses or the like,
- which you could do.
-
- >>Nothing fancy - just the very basic kind: need to keep one child process
- >>from reading/writing a common file when a 2nd process is dealing with
- >>that file.
-
- This, of course, is impossible in C, although you could study the logic
- by writing emulation of multiple processes in C.
-
- >You need to system specific facilities provided by your implemenation.
- >Those are probably Unix specific in this case so try comp.unix.programmer.
-
- Yes, conveniently, all the hooks are there, and it would be much faster to do
- this in Unix than in C.
-
- -s
- --
- Peter Seebach - seebs@solon.com - Copyright 1996 Peter Seebach.
- C/Unix wizard -- C/Unix questions? Send mail for help. No, really!
- FUCK the communications decency act. Goddamned government. [literally.]
- The *other* C FAQ - http://www.solon.com/~seebs/c/c-iaq.html
-